import isValidKey from "./isValidKey";
export function getInterfaceRoute(name: string) {
  if(isValidKey(name, interfaceRoute)) {
    return interfaceRoute[name];
  }
  else {
    throw console.error();
  }
}

const URL = {
  develop: '',
  product: '',
  local: 'http://127.0.0.1/csm',
}
export const url = URL.local;
// 开发环境
const ENV = url + '/index.php?r=';
// 选择环境
const DOMAIN = ENV;
//接口地址
const interfaceRoute = {
  GetCourse:DOMAIN +'user/GetCourse',
  Login:DOMAIN+'user/WxLogin',
  BindAdmin:DOMAIN+'user/BindWxAdmin',
  getGradeClasses:DOMAIN+'user/GetClasses',
  updateUserInfo:DOMAIN+'user/update',
  getGradeMajor:DOMAIN+'activity/GetMajor',
  GetActivity:DOMAIN+'activity/GetActivity',
  addActivity:DOMAIN+'activity/Add',
  JoinActivity:DOMAIN+'activityJoin/JoinActivity',
  CancelJoin:DOMAIN+'activityJoin/CancelJoin',
  GetJoinData:DOMAIN+'activityJoin/GetJoinData',
  GetJoinAccount:DOMAIN+'activityJoin/GetJoinAccount',
  GetStudentData:DOMAIN+'activityJoin/GetStudentData',
  GetSignDetail:DOMAIN+'sign/WxGetSignDetail',
  SignIn:DOMAIN+'sign/WxSign',
  uploadJoin:DOMAIN+'activityStudents/uploadJoin',
  uploadlist:DOMAIN+'activityStudents/uploadlist',
  upload:DOMAIN+'activityStudents/upload',
  fileUrl:DOMAIN+'activityStudents/fileUrl',
  GetJoinActivity:DOMAIN+'activityJoin/GetJoinActivity',
  AddLook:DOMAIN+'activity/AddLook',
  SAddLook:DOMAIN+'activityStudents/SAddLook',
  GetSignHistory:DOMAIN+'sign/GetSignHistory',
  GetNotice:DOMAIN+'notice/GetNotice',
  addNotice:DOMAIN+'notice/Add',
  AddNoticeLook:DOMAIN+'notice/AddLook',
}
export const CURRENT_DOMAIN = DOMAIN; // 当前服务器URL